<template>
  <div>
    我是cp3组件
    <div>store in the cp3: {{ $store.state.userInfo }}</div>
    <button @click="showStore">我是cp3的按钮</button>
    <button @click="changeMoney">修改用户的money in cp3</button>
  </div>
</template>
<script setup>
import { useStore } from 'vuex';
// 在setup配置api当中我们需要通过  vuex的useStore来获取全局的store对象
const store = useStore();

const showStore = () => {
  console.log('store in cp3', store);
};

const changeMoney = () => {
  store.commit('changeUserMoney', 80);
};
</script>
